
$('#toko').datagrid({
				title:'List Toko Reseller',
				//iconCls:'icon-ok',
				width:'auto',
				height:tinggi-225,
				nowrap: true,
				autoRowHeight: false,
				singleSelect:true,
				striped: true,
				collapsible:false,
				url: host+'backend/get_data/tbl_toko_user/all',
				pagination:"true",
				queryParams:{
					
				},
				
			toolbar:[
					 {
						text:'Delete',
						iconCls:'delete',
						handler:function(){
							cek_grid('delete','HAPUS');
						}
					 },'-',
					 {
						text:'Lihat Rincian Produk Toko',
						iconCls:'view',
						handler:function(){
							cek_grid('lihat','HAPUS');
						}
					 }
				
			],	
			
				columns:[[
					{field:'ck', checkbox:true},
					{field:'nama_toko' ,title:'Nama Toko', width:150, sortable:true},
					{field:'deskripsi' ,title:'Deskripsi', width:200, sortable:true},
					{field:'nama_lengkap' ,title:'Nama Reseller', width:150, sortable:true},
					{field:'tgl_buat' ,title:'TGL Buat', width:150, sortable:true}
					
					
				]]
});

function cek_grid(tbl,jdl){
		row = $('#toko').datagrid('getSelected');
		if(row){
			if(tbl=='delete'){
				$.messager.confirm('Confirm','Yakin Data Produk Ini Akan Dihapus ?',function(r){  
					if (r==true){  
					  	$.post(host+'backend/hapus/tbl_toko_user',{id:row.id,user:row.tbl_user_id},function(resp){
							if(resp==1){$.messager.alert("Data","Data Sudah Terhapus",'info');$('#toko').datagrid('reload');}		   
						});	
					}  
				}); 
			}
			
			else{
				//mywindow('a','AA');
				$.post(host+'backend/get_form/lihat_toko',{id:row.id},function(r){
					mywindow(r,'Lihat ISI Toko',lebar-400,tinggi-325);
				});
			}
		
			
		}
		else{$.messager.alert("Data","Pilih Salah Satu Data",'error');}
}